<%@page contentType="text/html; charset=UTF-8"%>
<%@ page language="java" import="java.util.*,java.sql.*,java.io.*"  pageEncoding="utf-8"%>
<%@ page import="java.sql.*,java.util.*,oracle.jdbc.driver.OracleDriver"%>
<%@page import="java.util.Date,java.text.SimpleDateFormat" %>
<%@ include file="classes/conndb.jsp" %>
<%@ page isELIgnored="false"%>
<% 
	request.setCharacterEncoding("utf-8"); 
//分页开始
	    String website_id = request.getParameter("website_id")==null?"":request.getParameter("website_id");
        Connection conn = null;
        PreparedStatement pst = null;
        ResultSet rs = null, rs2 = null, rs3 = null;

        int pageSize = 500;
        int currentPage = 1;
        int total = 0;
        if ((request.getParameter("currentPage")) != null) {
            currentPage = Integer.valueOf(request.getParameter("currentPage"));
        }
        if (pageSize == 0) {
            pageSize = 10;
        }
        if (currentPage <= 0) {
            currentPage = 1;
        }
        int start = (currentPage - 1) * pageSize;
        int end = (currentPage - 1) * pageSize + pageSize;
        String addSql1="";
        String addSql="";
        String wheresql="";
        String sql = "select * from cms_website t where t.parent_website_id = '"+website_id+"' and t.status= 3";
   		//out.print(sql);
        try {
            conn = getConnection();
//查询总记录数
            String countSql = "select count(*) from (" + sql + ")";
            pst = conn.prepareStatement(countSql);
            rs = pst.executeQuery();
            while (rs.next()) {
                total = rs.getInt(1);
            }
//分页查询

            String sql1 = "select tt3.* from (select rownum as r,tt2.* from (";
            String sql2 = ") tt2 where rownum<= ?) tt3 where tt3.r > ? ";
            String querySql = sql1 + sql + sql2;
            pst = conn.prepareStatement(querySql);
            pst.setObject(1, end);
            pst.setObject(2, start);
            rs = pst.executeQuery();

//封装变量
            Map pageMap = new HashMap();
            pageMap.put("currentPage", currentPage);
            pageMap.put("total", total);
            request.setAttribute("page", pageMap);
%>
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
		<title>信息发布</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
    body{font-size:12px;}
    a{color:#333; text-decoration:none;}
    a:hover{color:#333;}
    .tr_center th{
    	text-align: center;
    }
    .show-grid [class^="col-"]{
    	padding-top: 10px;
		padding-bottom: 10px;
		background-color: #eee;
		border: 1px solid #ddd;
		background-color: rgba(86,61,124,.15);
		border: 1px solid rgba(86,61,124,.2);
    }
    .show-grid{
    	margin-bottom: 15px;
    }
    .bold{
    	font-weight: bold;
    }
</style>
<!-- 最新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/datepicker.css">

	</head>              
                       
  <body>
<div class="container">
  <div class="table-responsive">
		<table  class="table">
			<thead>
				<tr class="tr_center">                                  
					<th class="iPhone">站点</th>  
				</tr>
			</thead>
			<tbody>
				<%
				while(rs.next()){
                    String id = rs.getString("website_id")==null?"":rs.getString("website_id");
					String name = rs.getString("name")==null?"":rs.getString("name");
				%>
					<tr bgcolor="#FFFFFF" >
						<td align="center"><a href="http://htgl.cnsn.gov.cn/website-webapp/bs_show/xxfb_list.jsp?website_id=<%=id%>&data=<%=new Date().getTime()%>" target="_blank"><%=name%></a></td>
					</tr>
				<%		            
					}
				%>
				</tbody>
			</table> 
		</div>
<div>
	<!-- 分页显示开始 -->
	<jsp:include page="common/page.jsp" >
                        <jsp:param value="${page.currentPage }" name="currentPage"/>
                        <jsp:param value="${page.total }" name="totalRecord"/>
                        <jsp:param value="500" name="pageSize"/>
      <jsp:param value='form2' name="formName"/>
    </jsp:include>
<!-- 分页显示结束 -->
</div>

</div>
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="js/jquery-1.6.2.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="js/bootstrap.min.js"></script>
<!-- datepicker -->
<script src="js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
var publishManuscript = function(){
    var n=0;
     $(".table tbody").find("tr").each(function(){
  $.post("http://htgl.cnsn.gov.cn/website-webapp/wcm/submit_manuscript.action?manuscriptId="+$(this).attr("data-id")+"__"+$(this).attr("data-chid")+"&channelId="+$(this).attr("data-chid"));
  console.log(n++);
        });
}
       
</script>
  </body>
</html>
<% conn.close();
    } catch (SQLException e1) {
        out.print(e1);
    }
%>
<!-- 
名称:项目组处理列表页面
说明:只限项目组成员使用
时间:2014-03-26 修改
-->